<template>
	<view class="box">
		<!-- top -->
		<view class="top">
			<view>
				<u-alert :title="title" type="warning" :description="description"></u-alert>
			</view>
		</view>
		<!-- main -->
		<view class="main">
			<view class="add-carplate" @click=" goToUrl('/pages/user/addcar')">
				<view class="left">
					<u-icon name="plus"></u-icon>
					<text>添加车辆</text>
				</view>
				<view>
					<u-icon name="arrow-right"></u-icon>
				</view>
			</view>
			<view>
				<u-empty mode="list" icon="http://cdn.uviewui.com/uview/empty/list.png">
				</u-empty>

			</view>

		</view>
		<u-datetime-picker :show="show" v-model="birthday" mode="date" @cancel="show = false"
			@confirm="confirmDate"></u-datetime-picker>

	</view>
</template>
<script>
export default {
	data() {
		return {
			fileList: [],
			telNum: "",
			show: false,
			date_: "",
			birthday: Number(new Date()),
			description: "您还可以添加3个车牌"
		}
	},
	methods: {
		afterRead(event) {
			console.log(event)
			this.fileList[0] = event.file.url
		},
		checkTelephone(telephone) {
			var reg = /^[1][3,4,5,7,8][0-9]{9}$/;
			if (!reg.test(telephone)) {
				return false;
			} else {
				return true;
			}
		},
		checkTel() {
			const res = checkTelephone(telNum.value)
			if (!res) {
				uni.showToast({
					icon: 'none',
					title: '请输入正确的手机号码'
				})
			}
		},
		confirmDate(e) {
			const date = new Date(e.value)
			const year = date.getFullYear()
			const month = date.getMonth() + 1
			const day = date.getDate()
			this.date_ = year + '-' + month + '-' + day
			this.show = false
		}
	}
}
</script>
<style lang="scss" scoped>
.box {
	background-color: #eee;
	height: 100vh;
}

.add-carplate {
	@include flex-center(row, space-between, center);
	padding: 20rpx;
	background-color: #fff;
	border-radius: 10rpx;
	margin-top: 20rpx;

	.left {
		@include flex-center(row, flex-start, center);

		text {
			margin-left: 10rpx;
			font-size: 24rpx;

		}
	}
}

.main {
	padding: 0 40rpx;

	.item {
		display: flex;
		flex-wrap: nowrap;
		justify-content: flex-start;
		margin-bottom: 40rpx;
		padding: 10rpx 0;

		::v-deep .u-text {
			flex: 1.5;
		}

		::v-deep .u-input {
			flex: 3;
		}
	}
}
</style>
